<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>5-猜数字游戏</title>
	</head>
	<body>
		<script type="text/javascript">
			function getRandom(min,max){
				return Math.floor(Math.random()*(max-min+1))+min;
			}
			var random =getRandom(1,10);
			console.log(random);
			 while(true){
				var num = prompt('输入数字');
				if(num>random){
					alert('猜大了');
				}else if(num<random){
					alert('猜小了');
				}else{
					alert('猜对了');
					break;
				}
			 
			}
		</script>
	</body>
</html>
